<?php
$consumeAll = \common\models\BusMemberConsume::getConsumeAll(Yii::$app->getRequest()->get('id'));
?>

<?= $this->render('header'); ?>

<div class="row borB">
	<div class="container">
		<div class="mg20-y">
			<span>储蓄卡：<em class="red">￥<?= $BusMember['member_balance'] ?></em></span>
			<span class="ml20">赠送金：<em class="red">￥<?= $BusMember['member_give_balance'] ?></em></span>
			<span class="ml20">累计消费：<em class="red">￥<?= strpos($consumeAll, '.') === false ? $consumeAll . '.00' : '0.00' ?></em></span>
			<span class="ml20">欠款：<em class="red">￥<?= $BusMember['member_debt'] ?></em></span>
		</div>
	</div>

</div>
<div class="container">
	<div class="borB" style="font-size: 15px;line-height: 40px;">账户记录</div>
	<div class="mt20">
		<?php if(empty($list)){?>
		<table class="table table-bordered">
			<thead>
			<tr>
				<th>收入/支出</th>
				<th>类型</th>
				<th>时间</th>
				<th>金额</th>
				<th>变化后金额</th>
			</tr>
			</thead>
			<tbody>
			<tr>
				<td colspan="5" align="center"><img src="<?=Yii::getAlias('@web/backend/img/nodata.gif');?>"></td>
			</tr>
			</tbody>
		</table>
		<?php }else{?>
		<table class="table table-bordered">
			<thead>
			<tr>
				<th>收入/支出</th>
				<th>类型</th>
				<th>时间</th>
				<th>金额</th>
				<th>变化后金额</th>
			</tr>
			</thead>
			<tbody>

			<?php foreach($list as $account): ?>
			<tr>
				<td>
					<img src="<?= $account['account_type'] == 1 ? Yii::getAlias('@web/backend/img/member/income_ico.png') : Yii::getAlias('@web/backend/img/member/expenditure_ico.png') ?>" alt="<?= $account['account_type'] == 1 ? '收入' : '支出' ?>"/>
				</td>
				<td><?= $account['consume_type'] ?></td>
				<td><?= substr($account['account_time'], 0, 16) ?></td>
				<td><em class="red"><?= $account['account_type'] == 1 ? '+' : '-' ?>￥<?= $account['account_money'] ?></em></td>
				<td><em class="red">￥<?= $account['change_balance_money'] + $account['change_give_balance_money'] + $account['change_debt_money'] ?>.00</em></td>
			</tr>
			<?php endforeach; ?>

			</tbody>
		</table>
		<?php }?>
		<div class="page">
			<?= \yii\widgets\LinkPager::widget([
				'pagination' => $page,
				// 'hideOnSinglePage' => true
			]); ?>
		</div>

	</div>

</div>